<include file="Public:header" />
<include file="Public:left" />
<style>
    .ncap-btn{cursor: pointer;}
</style>
<form action="{:url('Project/add')}" method="post" enctype="multipart/form-data" id="brandForm">
    <section>
        <h2><strong>添加项目</strong></h2>
        <ul class="ulColumn2">
            <li>
                <span class="item_name" style="width:120px;">项目名：</span>
                <input type="text" name="title" class="textbox textbox_295" value="">（注：必填）
            </li>
            <li>
                <span class="item_name" style="width:120px;">项目编号：</span>
                <input type="text" name="number" class="textbox textbox_295" value="">
            </li>
            <li>
                <span class="item_name" style="width:120px;">开始时间：</span>
                <input type="text" class="textbox textbox_295" name="start_time" id="timea" placeholder="开始时间..." value=""/>
            </li>
            <li>
                <span class="item_name" style="width:120px;">结束时间：</span>
                <input type="text" class="textbox textbox_295" name="finish_time" id="timeb" placeholder="结束时间..." value=""/>
            </li>
            <li>
                <span class="item_name" style="width:120px;">预期完成时间：</span>
                <input type="text" class="textbox textbox_295" name="expect_time" id="timec" placeholder="预期完成时间..." value=""/>
            </li>
            <li>
                <span class="item_name" style="width:120px;">负责人联系方式：</span>
                <input type="text" name="mobile" class="textbox textbox_295" value="">
            </li>
            <li>
                <span class="item_name" style="width:120px;">总负责人 ：</span>
                <input type="text" name="user" class="textbox textbox_295" value="">
            </li>
            <li>
                <span class="item_name" style="width:120px;">添加参与者 ：</span>
                <input type="text" id="party"  value="">
                <a class="ncap-btn" onclick="add_party()">添加</a>
                <p class="notic">
                </p>
            </li>
            <li>

            </li>
            <li>
                <span class="item_name" style="width:120px;">参与者 ：</span>
                <div style="margin-left: 120px;">
                    <table>
                        <tr><th style="width:80%;">参与者</th><th style="width: 50px;text-align: center;" >操作</th></tr>
                        <tbody id="List">

                                <!--<tr><td><input name="partyList[]" type="text" value="" class="form-party" style="width:160px;"></td>-->
                                    <!--<td style="text-align: center;"><a class="ncap-btn" href="javascript:;" onclick="$(this).parent().parent().remove();">删除</a></td></tr>-->

                        </tbody>
                    </table>
                </div>
                <br/>
            </li>
            <li>
                <span class="item_name" style="width:120px;">项目完成情况：</span>
                <script id="editor" name="content" type="text/plain" style="width:700px;height:300px;margin-left:125px; margin-top:-12px;"></script>
            </li>

            <li>
                <span class="item_name" style="width:120px;"></span>
                <input type="submit" class="link_btn" value="提交"/>
            </li>
        </ul>
    </section>
</form>
<script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>
<script>
    laydate.render({
        elem: '#timea' //指定元素
        ,type:'datetime'
    });
    laydate.render({
        elem: '#timeb' //指定元素
        ,type:'datetime'
    });
    laydate.render({
        elem: '#timec' //指定元素
        ,type:'datetime'
    });
    function add_party(){
        var a = [];
        $('#List .form-party').each(function(i,o){
            if($(o).val() != ''){
                a.push($(o).val());
            }
        })
        var ncode = $('#party').val();
        if(ncode !== ''){
            var temp = ncode;
            if($.inArray(temp,a) != -1){
                layer.alert('此参与人已经添加！', {icon: 2,time: 1000});
                return false;
            }
        }
        var strtr = '<tr>';
        if(ncode!= ''){
            strtr += '<td><input name="partyList[]" type="text" value="'+ncode+'" class="form-party" style="width:160px;"></td>';
        }else{
            strtr += '<td><input name="partyList[]" type="text" value="" class="form-party" style="width:160px;"></td>';
        }
        strtr += '<td style="text-align: center;"><a href="javascript:;" class="ncap-btn" onclick="$(this).parent().parent().remove();">删除</a></td>';
        $('#List').append(strtr);
    }
</script>
<script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');


    function isFocus(e){
        alert(UE.getEditor('editor').isFocus());
        UE.dom.domUtils.preventDefault(e)
    }
    function setblur(e){
        UE.getEditor('editor').blur();
        UE.dom.domUtils.preventDefault(e)
    }
    function insertHtml() {
        var value = prompt('插入html代码', '');
        UE.getEditor('editor').execCommand('insertHtml', value)
    }
    function createEditor() {
        enableBtn();
        UE.getEditor('editor');
    }


</script>
</div>
</section>
</body>
</html>
